package com.jule.miaozhuapc.webSocket.WawaS1Socket;

import org.apache.log4j.Logger;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;


public class S1ThreadWriter extends Thread {

	private Logger logger = Logger.getLogger(S1ThreadWriter.class);

	Socket socket;
	String msg;

	public S1ThreadWriter(Socket socket, String msg) {
		this.socket = socket;
		this.msg = msg;
	}

	@Override
	public void run() {
		try {
			OutputStream os = socket.getOutputStream();
			os.write(msg.getBytes());
			os.write(new byte[] {'\n'});
			os.flush();
			logger.info(socket.getPort() + "给S1发送消息" + msg);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			logger.info(socket.getPort() + "给S1发送消息失败" + msg);
		}
	}
}